import paramiko
import time
ssh1=paramiko.SSHClient()
ssh1.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh1.connect(hostname='203.0.113.1',port=22,username='qytang',password='qytang',\
             timeout=5,allow_agent=False,look_for_keys=False)

cli=ssh1.invoke_shell()
time.sleep(15)
ssh1.close()
#
# #[huawei]
# cli.send('N\n')
# cli.send('screen-length 0 temporary\n')
# cli.send('display current-configuration\n')
#
# #[cisco]
# # cli.send('enable\n') ;cli.send('qytang\n')  #如果没有给定15级权限，则需要设置特权密码，并且执行提权指令和输入特权密码
# # cli.send('terminal length 0\n')
# # cli.send('show run\n')
#
# time.sleep(3)
# running_config=cli.recv(99999).decode()
# print(running_config)
#
# time.sleep(15)
# ssh1.close()  #关闭是必要的，否则可能引起python解释器在关机时挂起
#
#
